clear;clc;
alpha=1.5*pi/180;
theta=2*pi/3;
deltad=200;
d=-800:200:800;
D0=70;
h=D0-tan(alpha).*d;
len2=h*sin(theta/2)/(sin(pi/2+alpha-theta/2));
len1=h*sin(theta/2)/(sin(pi/2-alpha-theta/2));
x1=d-len1*cos(alpha);
y1=-h-len1*sin(alpha);
x2=d+len2*cos(alpha);
y2=-h+len2*sin(alpha);
W=cos(alpha)*(len1+len2);
for i = 2:length(d)
    yita(i)=h(i-1)*sin(theta/2)/sin(pi/2+alpha-theta/2)+h(i)*sin(theta/2)/sin(pi/2-alpha-theta/2)-deltad/cos(alpha);
    yita(i)=cos(alpha)*yita(i)/W(i);
end
for i=1:length(d)
    plot([d(i),x1(i)],[0,y1(i)]);
    hold on;
    plot([d(i),x2(i)],[0,y2(i)]);
    hold on;
    plot([x1(i),x2(i)],[y1(i),y2(i)]);
    hold on;
end
xlabel('测线距中心点处的距离/m')
ylabel('海水深度/m')


